import random
from module1 import judge_fun
player1money = 1000
player2money = 1000


while (1):
    if player1money == 0 :
        print("玩家输了")
        break
    elif player2money == 0:
        print("庄家输了")
        break

    xiazhu = int(input("input your debt"))

    if player1money < xiazhu :
        print("钱不够了")
        continue
    point = random.randint(2, 12)
    if point == 7 or point == 11 :
        player1money,player2money = judge_fun("玩家胜",player1money,player2money,xiazhu)
        continue
    elif point == 2 or point == 8 or point == 12 :
        player1money,player2money = judge_fun("庄家胜", player1money, player2money, xiazhu)
        continue
    else :
        while (1):
            point2 = random.randint(2, 12)
            if point2 == 7 :
                player1money,player2money =judge_fun("庄家胜", player1money, player2money, xiazhu)
                break
            elif point2 == point :
                player1money,player2money = judge_fun("玩家胜", player1money, player2money, xiazhu)
                break
            else :
                continue